import qs from 'qs';
// 统一管理接口地址
import request from '@/request/request';

// 定义对应的接口

// 精品推荐接口
export const JingPinAPI = () => request.get('/products/recommend');
// 热门兑换接口
export const ReMenAPI = () => request.get('/products/hot');
// 发送短信验证码请求
export const SendSMSAPI = (params) => request.post('/sendSMS', qs.stringify(params));
// 登录请求 /phoneRegin
export const PhoneReginAPI = (params) => request.post('/phoneRegin', qs.stringify(params));
// 微信登录（这个接口必须用qs对数据进行格式化）
export const WeixinLoginApi = (params) => request.post(`/wechatUsers/PCLogin`, qs.stringify(params));
// 手机绑定微信 /wechatUsers/binding
export const BindingApi = (params) => request.post(`/wechatUsers/binding`, qs.stringify(params));
// 获取用户信息 /shop/userProfiles
export const UserProfilesAPI = () => request.get('/shop/userProfiles');
// 商品详情页 /products/{id}
export const GoodsDetailsAPI = (id) => request.get(`/products/${id}`);
// 加入购物车 /shop/carts/add
export const CartsAddAPI = (params) => request.post('/shop/carts/add', qs.stringify(params));
// 全部商品 /products
export const GoodsSearchAPI = (params) => request.get('/products', { params }); //params:params
// 查看购物车 /shop/carts
export const CartDataAPI = () => request.get('/shop/carts');
// 购物车删除商品 /shop/carts?productIds={id}
export const DelshopCartsAPI = (id) => request.delete(`/shop/carts?productIds=${id}`);
